package com.ruoyi.app.controller

import com.ruoyi.app.common.Data
import com.ruoyi.app.domain.vo.AdvertisingVo
import com.ruoyi.app.domain.vo.BootPageVo
import com.ruoyi.app.service.AdvertisingApiService
import com.ruoyi.back.domain.AdvertisingSetting
import com.ruoyi.back.service.impl.AdvertisingSettingService
import io.swagger.annotations.Api
import io.swagger.annotations.ApiImplicitParam
import io.swagger.annotations.ApiImplicitParams
import io.swagger.annotations.ApiOperation
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

@RestController
@RequestMapping("/api/advertising")
@Api(tags = ["广告相关接口"])
class AdvertisingApiController {

    @Autowired
    private lateinit var advertisingApiService: AdvertisingApiService

    @ApiOperation("获取启动页")
    @GetMapping("getBootPageList")
    fun getBootPageList(): Data<List<BootPageVo>> = advertisingApiService.getBootPageList()

    @ApiOperation("获取广告列表")
    @GetMapping("getAdvertisingList/{type}")
    @ApiImplicitParams(
        ApiImplicitParam(
            name = "type",
            value = "1. 开屏广告 3.首页弹窗 4.漂浮广告 5. 个人中心 6. 会员任务页",
            type = "path",
            required = true
        )
    )
    fun getAdvertisingList(@PathVariable type: Int): Data<List<AdvertisingVo>> =
        advertisingApiService.getAdvertisingList(type)
}